home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / FREEMEM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  409 b   |  23 lines

  1. #include <stdio.h>
  2. #include <dos.h>
  3. main()
  4. {
  5.     unsigned segadd;
  6.     if(allocmem(10, &segadd) != -1)
  7.     {
  8.         perror("Memory allocation failed");
  9.         exit(0);
  10.     }
  11.     printf("10 paragraphs of memory allocated\n"
  12.         "at segment address: %x\n", segadd);
  13. /* Free memory before exiting */
  14.     if(freemem(segadd) != 0)
  15.     {
  16.         perror("freemem failed");
  17.     }
  18.     else
  19.     {
  20.         printf("The memory is released now.\n");
  21.     }
  22. }
  23.